package com.design.base;

public class MyTask implements Runnable{
    // 任务编号
    private final int id;
    public MyTask(int id) {
        this.id = id;
    }
    @Override
    public void run() {
        String threadName = Thread.currentThread().getName();
        System.out.println("任务编号: " + id + ", 当前线程即将执行: " + threadName);
        try {
            Thread.sleep(200);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("任务编号: " + id + ", 当前线程执行完毕: " + threadName);
    }
}
